<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Mr.Cai
  Date: 2021/3/2
  Time: 9:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<head>
    <title>Title</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="../css/mymain.mymain.css">
    <script type="application/javascript" src="../js/jquery-3.3.1.js"></script>
    <script type="application/javascript" src="../js/bootstrap.min.js"></script>
    <script type="application/javascript" src="../layui/layui.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>

</head>
<body>

<table style="width: 90%;margin: 5px auto"  class="layui-table">
    <tr>
        <td>订单号</td>
        <td>订单金额</td>
        <td>所属用户</td>
        <td>车辆名称</td>
        <td>车辆类型</td>
        <td>车辆座位数</td>
        <td>车辆日租金</td>
        <td>取车地址</td>
        <td>还车地址</td>
        <td>订单状态</td>
        <td> 操作</td>
    </tr>
    <c:forEach items="${orders}" var="o">
        <tr>
            <td>${o.id}</td>
            <td>${o.oprice}</td>
            <td>${o.user.tel}</td>
            <td>${o.car.name}</td>
            <td>${o.car.type}</td>
            <td>${o.car.sitnum}</td>
            <td>${o.car.price}</td>
            <td>${o.getAddr.name}</td>
            <td>${o.backAddr.name}</td>
            <td>${o.status}</td>
            <td>

                <a  href="javascript:reDelete(${o.id})" class="myDelete">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
<script>
    function reDelete(id){
        if (confirm("确定删除该用户？")){

            // $(".myDelete").attr("href","/order/del?id="+id);
$.ajax({
    url:'/order/del?id='+id,
    type:'get',
    dataType:'json',
    success:function (res) {

        window.location.href="/order/selectAll";

    }

});

        }
    }
</script>
</body>
</html>
